#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void dfs(int a[]);
void aha(int setp);
int a[10], book[10], n;
/*
b站学习C++ STL视频练习
*/
int main()
{
    int a[]{1, 2, 3};

#if 0
    do{
        cout<<a[0]<<a[1]<<a[2]<<endl;
    }while(next_permutation(a,a+3));
#endif
#if 0
    while(next_permutation(a,a+3)){
        cout<<a[0]<<a[1]<<a[2]<<endl;
    }

#endif
    n = 3;
    aha(1);
    return 0;
}
void dfs(int a[])
{
}
void aha(int step)
{
    if (step == n + 1)
    {
        for (int i = 1; i <= n; i++)
        {
            cout << a[i] << " ";
        }
        cout << endl;
    }
    for (int i = 1; i <= n; i++)
    {
        if (book[i] == 0)
        {
            a[step] = i;
            book[i] = 1;
            aha(step + 1);
            book[i] = 0;
        }
    }
}